package behavioralPattern.memento.example02;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * 备忘录类
 *  -- 备份玩家状态
 */
@Data
class Memento {

    private int money;

    private ArrayList fruits;

    public Memento(int money) {
        this.money = money;
        this.fruits = new ArrayList();
    }

    public int getMoney(){
        return this.money;
    }

    List getFruits(){
        return (List) fruits.clone();
    }

    // 添加水果
    void addFruit(String fruit){
        fruits.add(fruit);
    }
}
